home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
PC
/
MISCBAS
/
MAZE.ASC
< prev
next >
Wrap
Text File
|
1987-01-11
|
5KB
|
198 lines
100 REM WRITTEN BY JACK HAUBER UPDATED 5-21-77 D. NIXON
110 WIDTH 80
120 DEFINT A-Z
130 PRINT "THIS PROGRAM WILL PRINT OUT A DIFFERENT MAZE EVERY TIME IT"
140 PRINT "IS RUN AND GUARANTEES ONLY ONE PATH THROUGH. YOU CAN CHOOSE"
150 PRINT "THE DIMENSIONS OF THE MAZE. I.E. THE NUMBER OF SQUARES WIDE"
160 PRINT "AND THE NUMBER OF SQUARES LONG."
170 PRINT
180 PRINT "WHAT ARE YOUR WIDTH AND LENGTH";
190 INPUT H,V
200 DIM W(H,V),V(H,V)
210 PRINT
220 IF H>2 AND V>2 THEN 260
230 PRINT "MEANINGLESS DIMENSIONS, TRY AGAIN."
240 PRINT
250 GOTO 1950
260 IF H< 27 GOTO 290
270 PRINT " THE WIDTH IS WIDER THEN 80 COLUMNS"
280 GOTO 1950
290 PRINT
300 PRINT
310 LET Q = 0
320 LET Z = 0
330 LET X = INT(RND(1)*H+1)
340 FOR I = 1 TO H
350 IF I = X THEN 380
360 PRINT ":--";
370 GOTO 390
380 PRINT ": ";
390 NEXT I
400 PRINT ":"
410 LET C = 1
420 LET W(X,1) = C
430 LET C = C+1
440 LET R = X
450 LET S = 1
460 GOTO 570
470 IF R <> H THEN 550
480 IF S <> V THEN 520
490 LET R = 1
500 LET S = 1
510 GOTO 560
520 LET R = 1
530 LET S = S+1
540 GOTO 560
550 LET R = R+1
560 IF W(R,S) = 0 THEN 470
570 IF R-1 = 0 THEN 930
580 IF W(R-1,S) <> 0 THEN 930
590 IF S-1 = 0 THEN 740
600 IF W(R,S-1) <> 0 THEN 740
610 IF R = H THEN 650
620 IF W(R+1,S) <> 0 THEN 650
630 LET X = INT(RND(1)*3+1)
640 ON X GOTO 1320,1390,1460
650 IF S <> V THEN 690
660 IF Z = 1 THEN 720
670 LET Q = 1
680 GOTO 700
690 IF W(R,S+1) <> 0 THEN 720
700 LET X = INT(RND(1)*3+1)
710 ON X GOTO 1320,1390,1560
720 LET X = INT(RND(1)*2+1)
730 ON X GOTO 1320,1390
740 IF R = H THEN 850
750 IF W(R+1,S) <> 0 THEN 850
760 IF S<> V THEN 800
770 IF Z = 1 THEN 830
780 LET Q = 1
790 GOTO 810
800 IF W(R,S+1) <> 0 THEN 830
810 LET X = INT(RND(1)*3+1)
820 ON X GOTO 1320,1460,1560
830 LET X = INT(RND(1)*2+1)
840 ON X GOTO 1320,1460
850 IF S <> V THEN 890
860 IF Z = 1 THEN 920
870 LET Q = 1
880 GOTO 900
890 IF W(R,S+1) <> 0 THEN 920
900 LET X = INT(RND(1)*2+1)
910 ON X GOTO 1320,1560
920 GOTO 1320
930 IF S-1 = 0 THEN 1140
940 IF W(R,S-1) <> 0 THEN 1140
950 IF R=H THEN 1060
960 IF W(R+1,S) <> 0 THEN 1060
970 IF S<> V THEN 1010
980 IF Z = 1 THEN 1040
990 LET Q = 1
1000 GOTO 1020
1010 IF W(R,S+1) <> 0 THEN 1040
1020 LET X = INT(RND(1)*3+1)
1030 ON X GOTO 1390,1460,1560
1040 LET X = INT(RND(1)*2+1)
1050 ON X GOTO 1390,1460
1060 IF S <> V THEN 1100
1070 IF Z = 1 THEN 1130
1080 LET Q = 1
1090 GOTO 1110
1100 IF W(R,S+1) <> 0 THEN 1130
1110 LET X = INT(RND(1)*2+1)
1120 ON X GOTO 1390,1560
1130 GOTO 1390
1140 IF R = H THEN 1240
1150 IF W(R+1,S) <> 0 THEN 1240
1160 IF S <> V THEN 1200
1170 IF Z = 1 THEN 1230
1180 LET Q = 1
1190 GOTO 1210
1200 IF W(R,S+1) <> 0 THEN 1230
1210 LET X = INT(RND(1)*2+1)
1220 ON X GOTO 1460,1560
1230 GOTO 1460
1240 IF S <> V THEN 1280
1250 IF Z = 1 THEN 1310
1260 LET Q = 1
1270 GOTO 1290
1280 IF W(R,S+1) <> 0 THEN 1310
1290 GOTO 1560
1300 REM BLOCKED
1310 GOTO 1760
1320 LET W(R-1,S) = C
1330 LET C = C+1
1340 LET V(R-1,S) = 2
1350 LET R = R-1
1360 IF C = H*V+1 THEN 1770
1370 LET Q = 0
1380 GOTO 570
1390 LET W(R,S-1) = C
1400 LET C = C+1
1410 LET V(R,S-1) = 1
1420 LET S = S-1
1430 IF C = H*V+1 THEN 1770
1440 LET Q = 0
1450 GOTO 570
1460 LET W(R+1,S) = C
1470 LET C = C+1
1480 IF V(R,S) = 0 THEN 1510
1490 LET V(R,S) = 3
1500 GOTO 1520
1510 LET V(R,S) = 2
1520 LET R = R+1
1530 IF C = H*V+1 THEN 1770
1540 LET Q = 0
1550 GOTO 930
1560 IF Q = 1 THEN 1660
1570 LET W (R,S+1) = C
1580 LET C = C+1
1590 IF V(R,S) = 0 THEN 1620
1600 LET V(R,S) = 3
1610 GOTO 1630
1620 LET V(R,S) = 1
1630 LET S = S+1
1640 IF C = H*V+1 THEN 1770
1650 GOTO 570
1660 LET Z = 1
1670 IF V(R,S) = 0 THEN 1710
1680 LET V(R,S) = 3
1690 LET Q = 0
1700 GOTO 1760
1710 LET V(R,S) = 1
1720 LET Q = 0
1730 LET R = 1
1740 LET S = 1
1750 GOTO 560
1760 GOTO 470
1770 FOR J = 1 TO V
1780 PRINT "I";
1790 FOR I = 1 TO H
1800 IF V(I,J) < 2 THEN 1830
1810 PRINT " ";
1820 GOTO 1840
1830 PRINT " I";
1840 NEXT I
1850 PRINT
1860 FOR I = 1 TO H
1870 IF V(I,J) = 0 THEN 1910
1880 IF V(I,J) = 2 THEN 1910
1890 PRINT ": ";
1900 GOTO 1920
1910 PRINT ":--";
1920 NEXT I
1930 PRINT ":"
1940 NEXT J
1950 ERASE W,V
1960 FOR I=1 TO 5: PRINT: NEXT I
1970 GOTO 180
1980 END
1920 NEXT I
1930 PRINT ":"
1940 NEXT J
1950 ERASE W,V
1960 FOR I=1 TO 5: PRINT: NEXT I
1970 GOTO 180
1980 END